package chapter10;

public abstract class Event {
	protected long delayTime;
	protected long eventTime;
	public Event(long delayTime)
	{
		this.delayTime=delayTime;
		start();
	}
	
	public void start()
	{
		this.eventTime=System.nanoTime()+this.delayTime;
	}
	
	public boolean ready()
	{
		long now=System.nanoTime();
		System.out.println("now:"+now+" eventtime:"+this.eventTime);
		return now>=this.eventTime;
	}
	public abstract void action();

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
